/*
Birth order models for other samples
*/

clear

use "D:\Data\ProjData\SiblingOrder\ReplicationAllpooled data 191128.dta", clear

set mat 1000
set more off

*Turnout within and between families
*Firstborn dummy
foreach num of numlist 1(1)5 {
reghdfe turnout birthorder_dum female i.age if samplenum==`num', absorb(famid) cluster(famid)
reg turnout birthorder_dum female i.age if samplenum==`num' & e(sample), cluster(famid)
sum turnout if e(sample)
}

reghdfe turnout birthorder_dum female i.age i.samplenum, absorb(famid) cluster(famid)
reg turnout birthorder_dum female i.age i.samplenum if e(sample), cluster(famid)
sum turnout if e(sample)

*Firstborn dummy interacted with average turnout - demean average turnout
qui: reghdfe turnout c.birthorder_dum##c.turnout_average female i.age i.samplenum, absorb(famid) cluster(famid)
sum turnout_average if e(sample)
replace turnout_average = turnout_average - r(mean)
reghdfe turnout c.birthorder_dum##c.turnout_average female i.age i.samplenum, absorb(famid) cluster(famid)
reg turnout c.birthorder_dum##c.turnout_average female i.age i.samplenum if e(sample), cluster(famid)

*Parity
foreach num of numlist 1(1)5 {
reghdfe turnout i.birthorder female i.age if samplenum==`num', absorb(famid) cluster(famid)
reg turnout i.birthorder female i.age if samplenum==`num' & e(sample), cluster(famid)
}
reghdfe turnout i.birthorder female i.age i.samplenum, absorb(famid) cluster(famid)
reg turnout i.birthorder female i.age i.samplenum if e(sample), cluster(famid)


*Political interest within and between families
*Firstborn dummy
foreach num of numlist 2(1)5 {
reghdfe polinterest birthorder_dum female i.age if samplenum==`num', absorb(famid) cluster(famid)
reg polinterest birthorder_dum female i.age if samplenum==`num' & e(sample), cluster(famid)
sum polinterest if e(sample)
}
reghdfe polinterest birthorder_dum female i.age i.samplenum, absorb(famid) cluster(famid)
reg polinterest birthorder_dum female i.age i.samplenum if e(sample), cluster(famid)
sum polinterest if e(sample)


*Internal efficacy within and between families
*Firstborn dummy
reghdfe inteff birthorder_dum female i.age if samplenum==2, absorb(famid) cluster(famid)
reg inteff birthorder_dum female i.age if samplenum==2 & e(sample), cluster(famid)
sum inteff if e(sample)


*External efficacy within and between families
*Firstborn dummy
foreach num in 2 3 5 {
reghdfe exteff birthorder_dum female i.age if samplenum==`num', absorb(famid) cluster(famid)
reg exteff birthorder_dum female i.age if samplenum==`num' & e(sample), cluster(famid)
sum exteff if e(sample)
}
reghdfe exteff birthorder_dum female i.age i.samplenum, absorb(famid) cluster(famid)
reg exteff birthorder_dum female i.age i.samplenum if e(sample), cluster(famid)
sum exteff if e(sample)


*Civic duty within and between families
*Firstborn dummy
foreach num in 2 4 {
reghdfe civicduty birthorder_dum female i.age if samplenum==`num', absorb(famid) cluster(famid)
reg civicduty birthorder_dum female i.age if samplenum==`num' & e(sample), cluster(famid)
sum civicduty if e(sample)
}
reghdfe civicduty birthorder_dum female i.age i.samplenum, absorb(famid) cluster(famid)
reg civicduty birthorder_dum female i.age i.samplenum if e(sample), cluster(famid)
sum civicduty if e(sample)

